// Decompiled by DJ v3.7.7.81 Copyright 2004 Atanas Neshkov  Date: 2007-9-15 18:53:51

// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   i6.java

package com.zelix;

import java.util.*;

// Referenced classes of package com.zelix:
//            f6, h6, hs

class i6
    implements Iterator
{

    private final f6 a;
    private f6 b;
    private h6 c;
    private boolean d;
    private h6 e;

    i6(f6 f6_1, f6 f6_2)
    {
        a = f6_1;
        b = f6_2;
    }

    private h6 a()
    {
        if(d || e != null)
            return e;
        if(c == null)
            if(f6.a(b) != null)
                return f6.a(b);
            else
                return null;
        if(h6.b(c).size() > 0)
        {
            return (h6)h6.b(c).get(0);
        } else
        {
            h6 h6_1 = a(c);
            return h6_1;
        }
    }

    private h6 a(h6 h6_1)
    {
        h6 h6_2 = h6.c(h6_1);
        if(h6_2 == null)
            return null;
        int i = h6.b(h6_2).indexOf(h6_1);
        if(i < h6.b(h6_2).size() - 1)
            return (h6)h6.b(h6_2).get(i + 1);
        else
            return a(h6_2);
    }

    public boolean hasNext()
    {
        e = a();
        return e != null;
    }

    public Object next()
    {
        c = a();
        d = false;
        e = null;
        if(c == null)
            throw new NoSuchElementException();
        else
            return c;
    }

    public void remove()
    {
label0:
        {
            if(c != null && !d)
            {
                d = true;
                e = null;
                e = a(c);
                f6.a(b, c);
                c = null;
                if(hs.c == 0)
                    break label0;
            }
            throw new IllegalStateException();
        }
    }
}